package com.tracesystem.controller;


import com.tracesystem.commons.Result;
import com.tracesystem.controller.form.DailyReportForm;
import com.tracesystem.controller.form.MonthlyReportForm;
import com.tracesystem.controller.form.RecordForm;
import com.tracesystem.controller.info.DailyReportInfo;
import com.tracesystem.controller.info.MonthlyReportInfo;
import com.tracesystem.service.IssueWorkLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  工时记录信息处理接口
 * </p>
 *
 * @author Kevin Martin
 * @since 2022-03-23
 */
@Api(tags = "工时记录信息处理接口")
@RestController
@RequestMapping("/issueWorkLog")
public class IssueWorkLogController {
    @Autowired
    IssueWorkLogService issueWorkLogService;

    /*
     * @Description:记录工时
     * @Author: JMOCOK
     * @param recordForm: 工时记录参数
     * @return: com.tracesystem.commons.Result
     **/
    @ApiOperation("记录工时")
    @PostMapping("/record")
    public Result record(@RequestBody @Valid RecordForm recordForm){
        return issueWorkLogService.addLogWork(recordForm);
    }
    /*
     * @Description:查询日报表
     * @Author: JMOCOK
     * @param dailyReportForm: 获取日报表参数
     * @return: com.tracesystem.commons.Result<com.tracesystem.controller.info.DailyReportInfo>
     **/
    @ApiOperation("查询日报表")
    @PostMapping("/dailyReport")
    public Result<DailyReportInfo> dailyReport(@RequestBody DailyReportForm dailyReportForm){
        return issueWorkLogService.getDailyReport(dailyReportForm);
    }
    /*
     * @Description:查询月报表
     * @Author: JMOCOK
     * @param monthlyReportForm: 获取月报表参数
     * @return: com.tracesystem.commons.Result<com.tracesystem.controller.info.MonthlyReportInfo>
     **/
    @ApiOperation("查询月报表")
    @PostMapping("/monthlyReport")
    public Result<MonthlyReportInfo> monthlyReport(@RequestBody MonthlyReportForm monthlyReportForm){
        return issueWorkLogService.getMonthlyReport(monthlyReportForm);
    }
}

